package com.dmxh.controller;

import com.dmxh.result.Result;
import com.dmxh.service.ContentCategoryService;
import com.dmxh.vo.ContentCategoryVO;
import com.dmxh.vo.ContentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contentcategory")
public class ContentCategoryController {
    /*广告分类管理*/

    @Autowired
    private ContentCategoryService contentCategoryService;

    @GetMapping
    public Result queryContetnCategory(Integer pageNum,Integer pageSize,ContentCategoryVO categoryVO){
        return Result.ok().setData(this.contentCategoryService.queryContetCategory(pageNum,pageSize,categoryVO));
    }

    @PostMapping
    public Result saveContentCategory(@RequestBody ContentCategoryVO contentCategoryVO){
        return Result.ok().setData(this.contentCategoryService.saveContentCategory(contentCategoryVO));
    }

    @DeleteMapping
    public Result deleteContentCategory(@RequestParam Long id){
        return Result.ok().setData(this.contentCategoryService.deleteContentCategory(id));
    }

    @PutMapping
    public Result updateContentCategory(@RequestBody ContentCategoryVO contentCategoryVO){
        return Result.ok().setData(this.contentCategoryService.updateContentCategory(contentCategoryVO));
    }
}
